function twoSum(nums: number[], target: number): number[] {
  let num2: number;
  for (let i = 0; i < nums.length; i++) {
    console.log(target - nums[i]);
    num2 = nums.indexOf(target - nums[i], i + 1);
    if (num2 != -1) {
      return [i, num2];
    }
  }
  return [];
}
console.log(twoSum([2, 7, 11, 15], 9));
